I have set up a forum for JkDefrag, a place where you can ask
questions, give feedback about features you would like, share your
experiences, share code that uses the defragger library, and other
things about JkDefrag.
Jump to JkDefrag forum
- What is "disk fragmentation"?
- Imagine a book split into several parts, some pages are over here, other
pages in another room on another floor altogether. You will have to walk a lot
when you need to read the book. It may sound silly, but this is exactly what happens to
files on your harddisk. Defragmentation will put all the parts (fragments)
back together, making your computer a lot faster.
- What is "disk optimization"?
- Imagine a big library with lot's of books, spread out all over the
building and not sorted whatsoever. There is an index telling you exactly where
every book is, but you will have to walk a lot when you need
several books. This is exactly what happens on your harddisk,
the files that belong to an application can be all over the place, anywhere
on the harddisk. Optimization will bring all the files together in one place,
leaving the rest of the harddisk empty, and will sort the files, for example
alphabetically.
- How safe is it?
- JkDefrag is based on the standard defragmentation API by Microsoft,
a system library that is included in Windows 2000, 2003, XP, and Vista.
Most defragmenters are based on this API, including commercial defragmenters.
Basically all JkDefrag does is send "move this file to that location" commands
to the API. It does not touch the disk by itself, and is therefore extremely
solid. If your disks use NTFS then you're even safe
when the computer crashes in the middle of defragmenting.
Nevertheless, it's still a good idea to backup before defragmenting,
just like with other defragmenters, because the heavy use of the
harddisk may trigger a hardware fault (disk crash), and/or overheating
(disk, power supply, controller chipset, etc.).
- How do I specify an option, or select a single disk (or folder or file)?
- Take a look at the GUI wrappers, see the "Contributed by other people"
chapter. Personally I find the commandline the easiest way to specify options.
Another way is to create a shortcut to "JkDefrag.exe", open the properties
of the shortcut, and add the desired commandline options (for example "-a 7")
or the name(s) of the disk/folder/file (for example "C:") to the end of the
"target" line. For example:
"C:\JkDefrag\JkDefrag.exe" -a 7 |
"C:\JkDefrag\JkDefrag.exe" D: |
Tip: In the same properties window you can select "minimized".
Tip: See the JkDefrag "-q" option to exit automatically when finished.
- Where is the Stop button?
-
All versions of JkDefrag can be stopped safely at any time, there is no
risk of losing data or corrupting your disk.
You can use all the usual ways to stop a Windows program, such as pressing ALT-F4,
clicking the 'x' in the top-right corner, via the pull-down menu in the
taskbar, or by killing the program via the task manager or another utility.
The commandline program can be stopped the same way, plus by pressing
CTRL-C, or BREAK. It may take a bit of time for the program to actually stop,
JkDefrag will finish the current file in the background.
- Does JkDefrag support RAID Disks, USB disks, floppies, memory sticks?
-
Yes, no problem whatsoever. JkDefrag does not know anything about the underlying
hardware, it leaves that up to Windows. It can therefore defragment and optimize
anything and everything that behaves like a disk.
Note: Removable media (for example floppies) are not processed by default,
but only when you specify the disk on the commandline (for example "jkdefrag G:").
- What is the best defragmentation/optimization strategy for me?
- My advise for all computers is to run JkDefrag once with the "-a 7" optimization
(sort by name), and from then on automatically every day with the default "-a 3"
fast-optimize option.
Note: The "-a 9" optimization (sort by last access time) only works as expected
if you do not use programs that scan all files on disk (such as virus scanners and
backup programs), causing Windows to update all the last access times.
- How can I run JkDefrag automatically every day?
- It's a great idea to run JkDefrag automatically every day by
adding it to the Windows scheduler, like this:
- Start -> Control Panel -> Scheduled Tasks -> Add Scheduled Task
- The wizard starts, click 'Next'.
- Use the 'browse' button to select the 'JkDefragCmd.exe' program.
- Select 'daily', next, select a time, next.
- Enter a userid/password with administrator privileges, click 'Finish'.
Note: The commandline version of JkDefrag ("jkdefragcmd.exe") will exit
automatically when finished. See the "-q" option to do the same for the Windows
version.
Tip: See the "Settings" of the scheduled task to run only when the computer
is idle.
Tip: To start the task minimized, in the settings of the task change the
commandline into "start /min JkDefragCmd.exe".
Tip: Use the windows version of JkDefrag ("jkdefrag.exe") to prevent Windows
from switching to power-saving while JkDefrag is running.
- How do I use the screensaver?
- See the instructions in the "Install" chapter.
- How to run JkDefrag at boot-time?
- It's very easy to run JkDefrag automatically in the background when the
computer starts via the Windows Task Scheduler:
- Start -> Control Panel -> Scheduled Tasks -> Add Scheduled Task
- The wizard starts, click 'Next'.
- Use the 'browse' button to select the 'JkDefragCmd.exe' program.
- Select 'When my computer starts', click next.
- Enter a userid/password with administrator privileges, click 'Finish'.
Note: This will not defragment system files such as the page file. To do that
see the "see also" chapter for a link to Pagedefrag, a free utility by
Microsoft Technet (formerly SysInternals).
- How to start minimized, or maximized?
-
Make a shortcut to the "JkDefrag.exe" program, open the properties of
the shortcut, find the "run" setting, and select "minimized" or "maximized".
To run the commandline-version in a minimized window use "start /min jkdefragcmd.exe".
- How to run with a lower priority?
-
My advise is to use the JkDefrag"-s" commandline option to slow down the
program, but you can change the process priority like this:
cmd.exe /c start "JkDefrag" /BelowNormal "jkdefragCmd.exe" |
- How much minimum free disk space does JkDefrag require?
-
JkDefrag does not require a minimum free disk space, unlike many other
defragmenters. But:
- Windows reserves some space for expansion of the MFT, default is 12.5% of
the volume size.
This space is counted by Windows as free space because it can/will be used for
regular files when the rest of the volume is full. But JkDefrag cannot use this free
space.
- A file can only be defragmented if there is a gap on disk big enough to hold
the entire file. There may be plenty of free space, but what is needed is a
single big gap. In these cases JkDefrag will try to reduce the number of
fragments in the file by using the biggest gaps available.
- Why is my disk not perfectly optimized?
-
- There are many files that cannot be moved while Windows is running,
because they are in use by an application, or by a service, or by Windows
itself. See the "-d" commandline options and the logfile for more information.
They can be anywhere on disk and are usually fragmented into microscopically
small segments.
In other words, the harddisk is not a big block of
space where files can be moved at will, but thousands of
little blocks bounded by unmovable data.
A typical harddisk can easily contain tens of thousands of files,
all with different sizes. What is the optimum way to organize the files
into the blocks? The
number of permutations is astronomical, it boggles the mind.
JkDefrag doesn't even try to calculate them all.
It concerns itself with only one block at a time, trying to fit only
files from above the block, and limits itself to 0.5 seconds of
calculating time.
So it's very unlikely, if not impossible, for JkDefrag to perfectly
optimize your disk, more's the pity.
- Gaps are only filled with files from above the gap (fast optimization).
If there are
no files that fit the gap (all files are bigger) then the gap cannot
be filled.
- Files can only be fully defragmented if there is a gap large enough to
hold the entire file. If no such gap is available then JkDefrag will
try to reduce the number of fragments by moving the file to the largest
gaps available.
- JkDefrag maintains a "free space" area between the directories
and the regular files, and between the regular files and the SpaceHogs.
This is by design. See the "-f" commandline option to control the size
of these free spaces.
- Why do the sorting optimizations create fragments?
- The sorting optimizations will move all the data to the beginning of the
harddisk. But there may be some unmovable files in the way. Instead of leaving
gaps (if a file doesn't fit between the last file and the unmovable file),
the program will "wrap around" the unmovable files by splitting regular files
into fragments. This may seem strange for a
defragmenter, but the fragments are aligned and therefore have a very
small impact on performance. Gaps however would make all the files above the
gaps slower, because they would then be placed at a slightly slower part of
the harddisk than they need to be.
The fragments look terrible on the screen and in the statistics, but
are there to make your harddisk faster!
- What speed can I expect?
- It is impossible to predict how long a defragment/optimize will take. It depends
on things such as the optimization you have selected, the speed of your harddisk,
how big the files are, how much data is on the disk, and more.
Assuming a harddisk speed of 40 megabyte per second, then reading 100
gigabyte of data will take 100000 / 40 = 2500 seconds (42 minutes).
But JkDefrag has to do a lot more than just read the data, it also has to write
the data, and update the MFT/FAT. And it may have to move data out of the way
before it can place an item were it want's it to be. JkDefrag will do
things as efficiently as possible, with as little data movement as possible,
but it will take a long time nonetheless. If you are concerned about speed
then use the default "-a 3" (fast optimize) setting. It will produce very
good results in a minimum amount of time, especially if you use it every day.
- What are SpaceHogs?
- SpaceHogs are less important files that take up a lot of space.
JkDefrag moves them behind the directories and the regular files, to make
those faster. The internal list of SpaceHogs is (you can add more with the
"-u" commandline option):
- Files bigger than 50 megabytes
- Files not accessed in the last month
- ?:\$RECYCLE.BIN\*
- ?:\RECYCLED\*
- ?:\RECYCLER\*
- ?:\WINDOWS\$*
- ?:\WINDOWS\Downloaded Installations\*
- ?:\WINDOWS\Ehome\*
- ?:\WINDOWS\Fonts\*
- ?:\WINDOWS\Help\*
- ?:\WINDOWS\I386\*
- ?:\WINDOWS\IME\*
- ?:\WINDOWS\Installer\*
- ?:\WINDOWS\ServicePackFiles\*
- ?:\WINDOWS\SoftwareDistribution\*
- ?:\WINDOWS\Speech\*
- ?:\WINDOWS\Symbols\*
- ?:\WINDOWS\ie7updates\*
- ?:\WINDOWS\system32\dllcache\*
- ?:\WINNT\$*
- ?:\WINNT\Downloaded Installations\*
- ?:\WINNT\I386\*
- ?:\WINNT\Installer\*
- ?:\WINNT\ServicePackFiles\*
- ?:\WINNT\SoftwareDistribution\*
- ?:\WINNT\ie7updates\*
- ?:\*\Installshield Installation Information\*
- ?:\I386\*
- ?:\System Volume Information\*
- ?:\windows.old\*
- *.7z
- *.arj
- *.avi
- *.bak
- *.bup
- *.bz2
- *.cab
- *.chm
- *.dvr-ms
- *.gz
- *.ifo
- *.log
- *.lzh
- *.mp3
- *.msi
- *.old
- *.pdf
- *.rar
- *.rpm
- *.tar
- *.vob
- *.wmv
- *.z
- *.zip
Note: Some virus scanners and other programs that scan all files on disk,
will change the last access time of all items on every run, effectively
disabling that particular SpaceHogs criterion. The other criteria still apply, though.
- Can I run JkDefrag outside Windows?
- JkDefrag is based on the Windows defragmentation library, so Windows
must be started. JkDefrag can be run from a bootable Windows CD-rom
(such as
Bart's Preinstalled Environment (BartPE)
or
Ultimate Boot CD for Windows
),
but cannot be run from a DOS bootable floppy or from Linux.
Tip: Boot into Windows safe mode by pressing F8 when booting, and then run JkDefrag.
It will be slower (the Windows cache is off in safe mode), but you can defragment more
files.
Warning: Do not hybernate your computer, boot with something else (such as BartPE),
and then change the hybernated disk in any way. This will corrupt the disk, a known
hybernation problem. JkDefrag refuses to process hybernated disks.
- Can JkDefrag do continuous background defragmenting?
- In my opinion continuous background defragmenting and optimization is marketing
hype and a bad idea. There is considerable overhead (CPU, memory, disk) that may
actually make your computer slower instead of faster, and it will wear out and
shorten the life span of your harddisk. I advise defragmenting once a day (via the
Windows Task Scheduler) at the most.
- What is the "Average end-begin distance"?
- When Windows has finished reading a file then the harddisk heads will have to move
to the beginning of whatever file is needed next. JkDefrag calculates the average distance
from the end of every file to the beginning of every other file, and shows this number in the
report (see the logfile). A lower number means that the files are better packed together
and can be accessed more quickly.
Note: The lowest possible average distance can be achieved by sorting by filesize.
- Can I "hide" the program from users?
-
See the "How to start minimized, or maximized?" question.
Running completely invisible is a bit more difficult.
Create a special userid (for example "jkdefrag") with administrator permissions,
then add a schedule to the Windows Task Scheduler (see the "How can I run JkDefrag
automatically every day?" question) and specify that
userid when asked for. The task will then run on that userid and not show anything
on the user's screen. But I advise against it, I think it will needlessly worry the
user when he sees a lot of mysterious disk activity.
- Why is JkDefrag so slow in Windows "safe" mode?
- The Windows disk cache is off in "safe" mode.
- How do I disable the Windows built-in defragger?
-
- Windows 2000 & 2003:
- The built-in defragger is not started automatically.
- Windows XP:
- Download the free
Tweak UI
utility from Micorosft.
- Click on 'General' and untick the 'Optimise hard disk when idle' box.
- Windows Vista:
- Start -> All Programs -> Accessories -> System Tools -> Disk Defragmenter
- Untick the "Run on a schedule (recommended)" box.
- How do I defragment "c:\pagefile.sys"?
-
One way is to download and install the free
Pagedefrag
utility by Microsoft TechNet (formerly Sysinternals),
it will automatically defragment the pagefile and some other system files
when the system is booting.
But even better is to set the pagefile to a fixed size, so it will never get
fragmented again. It's very easy to do:
-
Windows Vista: Open the "Control Panel", classic view. Double click "system".
Select "Advanced system settings". Click the Performance "Settings" button.
Select the "Advanced" tab. Click the Virtual Memory "Change" button.
Windows 2000: Open the "Control Panel". Double click "system".
Select the "advanced" tab. Click the "Performance Settings" button.
Click the Virtual Memory "Change" button.
- Write down the "Currently Allocated" number.
-
Windows Vista: Select "no paging file" for all disks.
Windows 2000: Set the Initial Size and the Maximum Size numbers
for all disks to zero.
- Reboot.
- Run JkDefrag.
- Go back to the same panel and setup a pagefile with a "custom size" where
both the Initial Size and the Maximum Size are the number you wrote down.
- Reboot again. The pagefile should now be a single big unfragmented
file that will never get fragmented again.
- How do I defragment "C:\hiberfil.sys"?
-
This huge file is used by the hibernation facility and cannot be defragmented on
a running system. You can only delete the file, like this:
- Windows Vista:
- Click Start -> All Programs -> Accessories, right click on "Command Prompt",
and then click "Run as Administrator". If User Account Control (UAC) asks you
for permission, permit the Command Prompt to run.
- Enter "powercfg -h off" (without the quotes).
- Reboot. The "hiberfil.sys" file will be automatically deleted.
- Repeat point 1
- Enter "powercfg -h on" (without the quotes).
- Reboot.
- Windows XP:
- Open the Control Panel
- Double-click Power Options
- Click the Hibernate tab, de-select the 'Enable hibernate support' check box,
and then click Apply.
- Reboot. The "hiberfil.sys" file will be automatically deleted.
- Go to the Windows Help & Support Center and search for 'enable hibernation'.
It should be the first result. The instructions detail some other steps you
may need to follow to reactivate the hibernation.
- Why does JkDefrag delete my restore points?
- It's not JkDefrag that is deleting your restore points.
Restore points use the Shadow Copy service to make snapshots of the disk. JkDefrag does not
change files (it only defragments or moves them), but it does change the disk (moving a file
is a change to the disk).
The Shadow Copy service remembers all these changes in big files in the
"C:\System Volume Information\...." folder. When the total amount of diskspace
used by shadow copies exeeds a threshold then the oldest snapshot (restore point) is
automatically deleted.
The threshold can be changed with the "vssadmin" command, see the
vssadmin manpage.
- How do I defragment "C:\System Volume Information\...."?
-
These huge files are used by the Shadow Copy service, which in turn is used by the
System Restore facility and by Windows backup.
The files can be defragmented on XP by stopping the Shadow Copy service ("srservice").
They cannot be defragmented on Vista. You can cleanup old shadow copies with
"Start -> Programs -> Accessories -> System Tools -> Disk Cleanup",
the "More Options" tab.
Or you can turn off System Restore altogether like this:
- Windows Vista:
- In Control Panel, click "System".
- Select "System Protection".
- If a disk has a checkmark then remove the checkmark.
- Windows XP:
- Open the properties of "My Computer".
- Select the "System Restore" tab. If you do not see the System Restore tab
then you are not logged on to Windows as an Administrator.
- Check "Turn off System Restore" or "Turn off System Restore on all drives".
- How do I defragment "C:\$Extend\$UsnJrnl:$J:$DATA"?
-
This huge file is used by Windows to track changes in other files and cannot be
defragmented. You can delete it by entering the following on the Run commandline
(Windows 2003/XP/Vista, not Windows 2000), it can take several minutes to finish:
fsutil usn deletejournal /n c: |
Note: See fsutil manpage
- Why use this defragger instead of the standard Windows defragger?
-
- Much faster.
- Totally automatic, extremely easy to use.
- Optimized for daily use.
- Data optimization, several strategies.
- Directories are moved to the beginning of the disk.
- Reclaims MFT reserved space after disk-full.
- Maintains free spaces for temporary files.
- Can defragment very full harddisks.
- Can defragment very large files.
- Can defragment individual directories and files.
- Can be run automatically with the Windows Scheduler.
- Can be used from the commandline.
- Can be used as a screen saver.
- Can be run from cdrom or memory stick.
- Sources available, can be customized.
- Why use this defragger instead of a commercial or shareware defragger?
-
- It's free.
- Totally automatic, extremely easy to use.
- Optimized for daily use.
- Several optimization strategies.
- Directories are moved to the beginning of the disk.
- Reclaims MFT reserved space after disk-full.
- Maintains free spaces for temporary files.
- Can defragment individual directories and files.
- Can be used from the commandline.
- Can be used as a screen saver.
- Can be run from cdrom or memory stick.
- Sources available, guaranteed to be free of spyware, malware, nagware, and such.
Tip: See the JkDefrag forum!!!
|